<template>
	<view class="page-wrap" :data-theme="theme" :style="globalColor.style">
		<header-custom title="设置" />
		<view class="container">
			<!-- <u-cell-group :border="false">
				<u-cell v-for="(item, index) in actionList" :key="index" :title="item.title" :border="false"
					:isLink="true" @click="goto(item.path)"></u-cell>
			</u-cell-group> -->
			
			<view class="cell font28 fboxRow Ycenter" v-for="(item, index) in actionList" :key="index" @click="goto(item.path)">
				<view class="flex1 font32">{{item.title}}</view>
				<text class="bwfont bw-arrow-right color-ACB4C7 font26"></text>
			</view>
			<!-- <view class="btn" v-if="isLogin" @tap="subLoginOut">退出登录</view> -->
		</view>
	</view>
</template>

<script>
	import headerCustom from '@/pagesBKS/components/header-custom.vue';
	import { loginOut } from '@/api/bks.mine'
	export default {
		components: {
			headerCustom
		},
		data() {
			return {
				theme: 'bks-theme',
				globalColor: getApp().globalData.globalColor,
				isLogin: false,
				actionList: [{
						title: '个人信息',
						path: '/bks/mine/setting/personal',
						// pages/mine/user/index
					},
					{
						title: '功能反馈',
						path: '/bks/mine/setting/feedback',
						// pages/mine/setting/feedback/index
					},
					{
						title: '修改手机号码',
						path: '/bks/mine/setting/bind',
						//pages/mine/setting/bind/index
					},
					// {
					// 	title: '消息提醒',
					// 	path: '/bks/mine/setting/index'
					// },
					// {
					// 	title: '注销账号',
					// 	path: '/bks/mine/setting/index'
					// }
				],
			}
		},
		onLoad: function(options) {
			try{
				const bw_bks_params = uni.getStorageSync('bw_bks_params')
				if(bw_bks_params && bw_bks_params.access_token){
					this.isLogin = true
				}
			}catch(e){
				//TODO handle the exception
				this.isLogin = false
			}
		},
		methods: {
			goto(url) {
				this.$pageTo(url);
			},
			// 退出登录
			subLoginOut() {
				try{
					loginOut().catch(e => {
						console.log(e)
					})
				}catch(e){
					//TODO handle the exception
				}
				uni.showToast({
					title: '已退出',
					icon: 'none',
					duration: 2000
				})
				uni.clearStorageSync()
				this.$pageTo('/bks/index/examinee/index', 'reLaunch')
			},
		}
	};
</script>

<style scoped lang="scss">
.cell{padding: 0 30rpx; height: 100rpx; color: var(--titleFontColor) ; border-bottom: 1rpx solid var(--backgroundDivisionColor) !important;}
.cell .value{color:var(--contentFontLightColor)}
.cell .bwfont{margin-left: 10rpx;}
	.page-wrap {
		min-height: calc(100vh);
	}

	.container .btn {
		margin: 0 30rpx;
		position: absolute;
		left: 0;
		right: 0;
		bottom: 60rpx;
		height: 84rpx;
		background: #F7F7F7;
		color: #E95241;
		font-size: 30rpx;
		line-height: 84rpx;
		text-align: center;
	}
</style>